/*****************************************************************************
 * plum_kal_mem.h
 *
 * Copyright (C) 2020 Jeasonvor 1101627719@qq.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/
#ifndef __PLUM_KAL_MEM_H__
#define __PLUM_KAL_MEM_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/*****************************************************************************
 * Public Types
 ****************************************************************************/

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/**
 * @brief:  申请内存
 *
 * @param[in]:  size    -   内存空间大小
 *
 * @return: 返回内存指针
 * **/
plum_void *plum_kal_mem_malloc(size_t size);

/**
 * @brief:  申请内存
 *
 * @param[in]:  nmemb   -   内存块个数
 * @param[in]:  size    -   内存块大小
 *
 * @return: 返回内存指针
 *
 * @note:   1.calloc所分配的空间大小为nmemb * size字节
 *          2.calloc会将分配的空间数据全部清零
 * **/
plum_void *plum_kal_mem_calloc(size_t nmemb, size_t size);

/**
 * @brief:  重新分配内存空间
 *
 * @param[in]:  ptr     -   原有内存指针
 * @param[in]:  size    -   重新分配内存大小
 *
 * @return: 返回内存指针
 * **/
plum_void *plum_kal_mem_realloc(plum_void *ptr, size_t size);

/**
 * @brief:  释放内存空间
 *
 * @param[in]:  ptr     -   内存指针
 *
 * @return:
 * **/
plum_void plum_kal_mem_free(plum_void *ptr);

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __PLUM_KAL_MEM_H__ */
/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
